import request from '@/utils/request'

const baseApi1 = process.env.VUE_APP_BASE_API1
const baseApi2 = process.env.VUE_APP_BASE_API2

// 登录
export function login(data) {
  return request({
    url: baseApi1 + '/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getInfo(token) {
  return request({
    url: baseApi2 + '/user/front/info',
    method: 'get',
    params: { token }
  })
}

// 获取所有菜单
export function getAllMenus() {
  return request({
    url: baseApi2 + '/user/front/menu/all',
    method: 'get'
  })
}

// 退出
export function logout(token, userId) {
  return request({
    url: baseApi1 + '/logout',
    method: 'post',
    params: { token, userId }
  })
}

// 获取图片验证码
export function GetCheckCode() {
  return request({
    url: baseApi1 + '/code/v2/get',
    method: 'get'
  })
}
